<!--
 * @Description: 定制窗帘
 * 
 * @Author: XiongYaoYuan<xiongyaoyuan>
 * @Date: 2023-07-17 20:29:21
 * @FilePath: /yuxiuproweb/src/views/mes/pro/preparation/tabs/curtain.vue
-->
<template>
  <div>
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      @submit.native.prevent
    >
      <el-form-item label="材料名称" prop="fabricName">
        <el-input
          v-model="queryParams.fabricName"
          filterable
          placeholder="请输入编码"
          @keyup.enter.native="getList"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="getList"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-printer"
          size="mini"
          @click="handlePrint"
          >打印</el-button
        >
      </el-col>
		
    </el-row>
    <el-table :data="list" :max-height="maxHeight" v-loading="loading">
      <el-table-column type="index" width="55" align="center" />
      <el-table-column label="材料名称" align="center" prop="name">
      </el-table-column>
      <el-table-column label="数量" align="center" prop="number" />
      <!-- <el-table-column label="总计" align="center" prop="sum" /> -->
      <el-table-column
        label="可用数量"
        align="center"
        prop="inventoryQuantity"
      />
      <el-table-column label="数量明细" align="center" prop="number_list" />
      <el-table-column
        label="可用数量明细"
        align="center"
        prop="inventory_quantity_list"
      />
    </el-table>

    <!-- 打印 -->
    <print-view
      v-if="print.show"
      :show.sync="print.show"
      v-bind="print"
    ></print-view>
  </div>
</template>

<script>
import { customCurtainList,getcl } from "@/api/asc/preparation";
import PrintView from "../mods/print.vue";
import commonMix from "@/utils/mixins/common";

export default {
  mixins: [commonMix],
  components: {
    PrintView,
  },
  data() {
    return {
      queryParams: {
        fabricName: "",
      },
      loading: false,
      list: [],
      print: {
        show: false,
        type: "0",
        data: null,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.loading = true;
      customCurtainList(this.queryParams).then((res) => {
        this.list = res.data || [];
        this.loading = false;
      });
    },
    resetQuery() {
      this.queryParams.fabricName = "";
      this.getList();
    },
    // 打印
    handlePrint() {
      this.print = {
        show: true,
        type: "0",
        data: this.list,
      };
    },
	handlecl(){
		this.loading = true;
		getcl().then((res) => {
		  // this.list = res.data || [];
		  // this.loading = false;
		  console.log(res)
		});
	},
  },
};
</script>
